package com.example.controller;

import com.example.pojo.BizParts;
import com.example.pojo.BizPartsrepertory;
import com.example.service.BizPartsrepertoryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Slf4j
@Controller
@RequestMapping("/partsrep")
public class PartsRepController {
    @Autowired
    private BizPartsrepertoryService bizPartsrepertoryService;

    @RequestMapping("/list")
    public String listPartsRep(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "3") Integer pageSize, BizParts bizParts, Map map){
        PageHelper.startPage(pageNum,pageSize);
        List<BizPartsrepertory> bizPartsrepertoryList = bizPartsrepertoryService.findAll(bizParts);
        PageInfo<BizPartsrepertory> pageInfo=new PageInfo<>(bizPartsrepertoryList);
        map.put("pageInfo",pageInfo);
        map.put("pageNum",pageNum);
        return "/partssys/partsrep/partsreplist";
    }
}
